namespace IAM.Interface.Model
{
    using IAM.Interface.Common;
    using IAM.Interface.Model.Interface;
    using System;
    using System.Text;

    [Serializable]
    public class Identity : AbstractConvertObject, IConvertXml
    {
        private AccountInfo _accountinfo = null;
        private string _bdapbr;
        private string _bdid;
        private string _bgapbr;
        private string _bgid;
        private string _buapbr;
        private string _buid;
        private string _cilaccount;
        private string _companyapbr;
        private string _companyid;
        private string _costcenter;
        private string _email;
        private string _ename;
        private string _firstname;
        private string _location;
        private string _mobile;
        private string _name;
        private AccountInfo _reportto;
        private string _telephone;

        public override object ConvertToObject()
        {
            this.Name = EnDeCoding.Decode(this.CurrentXmlNode.SelectSingleNode("Name").InnerText);
            this.EName = EnDeCoding.Decode(this.CurrentXmlNode.SelectSingleNode("EName").InnerText);
            this.FirstName = EnDeCoding.Decode(this.CurrentXmlNode.SelectSingleNode("FirstName").InnerText);
            this.EMail = EnDeCoding.Decode(this.CurrentXmlNode.SelectSingleNode("EMail").InnerText);
            this.Telephone = EnDeCoding.Decode(this.CurrentXmlNode.SelectSingleNode("Telephone").InnerText);
            this.Mobile = EnDeCoding.Decode(this.CurrentXmlNode.SelectSingleNode("Mobile").InnerText);
            this.CILAccount = EnDeCoding.Decode(this.CurrentXmlNode.SelectSingleNode("CILAccount").InnerText);
            this.CompanyAPBR = EnDeCoding.Decode(this.CurrentXmlNode.SelectSingleNode("CompanyAPBR").InnerText);
            this.CompanyID = EnDeCoding.Decode(this.CurrentXmlNode.SelectSingleNode("CompanyID").InnerText);
            this.BGAPBR = EnDeCoding.Decode(this.CurrentXmlNode.SelectSingleNode("BGAPBR").InnerText);
            this.BGID = EnDeCoding.Decode(this.CurrentXmlNode.SelectSingleNode("BGID").InnerText);
            this.BDAPBR = EnDeCoding.Decode(this.CurrentXmlNode.SelectSingleNode("BDAPBR").InnerText);
            this.BDID = EnDeCoding.Decode(this.CurrentXmlNode.SelectSingleNode("BDID").InnerText);
            this.BUAPBR = EnDeCoding.Decode(this.CurrentXmlNode.SelectSingleNode("BUAPBR").InnerText);
            this.BUID = EnDeCoding.Decode(this.CurrentXmlNode.SelectSingleNode("BUID").InnerText);
            this.CostCenter = EnDeCoding.Decode(this.CurrentXmlNode.SelectSingleNode("CostCenter").InnerText);
            this.Location = EnDeCoding.Decode(this.CurrentXmlNode.SelectSingleNode("Location").InnerText);
            this.Accountinfo = new AccountInfo();
            this.Accountinfo.CurrentXmlNode = this.CurrentXmlNode.SelectSingleNode("AccountInfo");
            this.Accountinfo = (AccountInfo) this.Accountinfo.ConvertToObject();
            this.ReportTo = new AccountInfo();
            this.ReportTo.CurrentXmlNode = this.CurrentXmlNode.SelectSingleNode("ReportTo/AccountInfo");
            this.ReportTo = (AccountInfo) this.ReportTo.ConvertToObject();
            return this;
        }

        public AccountInfo Accountinfo
        {
            get
            {
                return this._accountinfo;
            }
            set
            {
                this._accountinfo = value;
            }
        }

        public string BDAPBR
        {
            get
            {
                return this._bdapbr;
            }
            set
            {
                this._bdapbr = value;
            }
        }

        public string BDID
        {
            get
            {
                return this._bdid;
            }
            set
            {
                this._bdid = value;
            }
        }

        public string BGAPBR
        {
            get
            {
                return this._bgapbr;
            }
            set
            {
                this._bgapbr = value;
            }
        }

        public string BGID
        {
            get
            {
                return this._bgid;
            }
            set
            {
                this._bgid = value;
            }
        }

        public string BUAPBR
        {
            get
            {
                return this._buapbr;
            }
            set
            {
                this._buapbr = value;
            }
        }

        public string BUID
        {
            get
            {
                return this._buid;
            }
            set
            {
                this._buid = value;
            }
        }

        public string CILAccount
        {
            get
            {
                return this._cilaccount;
            }
            set
            {
                this._cilaccount = value;
            }
        }

        public string CompanyAPBR
        {
            get
            {
                return this._companyapbr;
            }
            set
            {
                this._companyapbr = value;
            }
        }

        public string CompanyID
        {
            get
            {
                return this._companyid;
            }
            set
            {
                this._companyid = value;
            }
        }

        public string CostCenter
        {
            get
            {
                return this._costcenter;
            }
            set
            {
                this._costcenter = value;
            }
        }

        public string EMail
        {
            get
            {
                return this._email;
            }
            set
            {
                this._email = value;
            }
        }

        public string EName
        {
            get
            {
                return this._ename;
            }
            set
            {
                this._ename = value;
            }
        }

        public string FirstName
        {
            get
            {
                return this._firstname;
            }
            set
            {
                this._firstname = value;
            }
        }

        public string Location
        {
            get
            {
                return this._location;
            }
            set
            {
                this._location = value;
            }
        }

        public string Mobile
        {
            get
            {
                return this._mobile;
            }
            set
            {
                this._mobile = value;
            }
        }

        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                this._name = value;
            }
        }

        public AccountInfo ReportTo
        {
            get
            {
                return this._reportto;
            }
            set
            {
                this._reportto = value;
            }
        }

        public string Telephone
        {
            get
            {
                return this._telephone;
            }
            set
            {
                this._telephone = value;
            }
        }

        public string XML
        {
            get
            {
                return (this.XMLBoday + this.XMLFinis);
            }
        }

        public string XMLBoday
        {
            get
            {
                StringBuilder xml = new StringBuilder();
                xml.Append("<Identity>");
                xml.Append(this.Accountinfo.XML);
                xml.Append("<Name>" + EnDeCoding.Encode(this.Name) + "</Name>");
                xml.Append("<EName>" + EnDeCoding.Encode(this.EName) + "</EName>");
                xml.Append("<FirstName>" + EnDeCoding.Encode(this.FirstName) + "</FirstName>");
                xml.Append("<EMail>" + EnDeCoding.Encode(this.EMail) + "</EMail>");
                xml.Append("<Telephone>" + EnDeCoding.Encode(this.Telephone) + "</Telephone>");
                xml.Append("<Mobile>" + EnDeCoding.Encode(this.Mobile) + "</Mobile>");
                xml.Append("<CILAccount>" + EnDeCoding.Encode(this.CILAccount) + "</CILAccount>");
                xml.Append("<CompanyAPBR>" + EnDeCoding.Encode(this.CompanyAPBR) + "</CompanyAPBR>");
                xml.Append("<CompanyID>" + EnDeCoding.Encode(this.CompanyID) + "</CompanyID>");
                xml.Append("<BGAPBR>" + EnDeCoding.Encode(this.BGAPBR) + "</BGAPBR>");
                xml.Append("<BGID>" + EnDeCoding.Encode(this.BGID) + "</BGID>");
                xml.Append("<BDAPBR>" + EnDeCoding.Encode(this.BDAPBR) + "</BDAPBR>");
                xml.Append("<BDID>" + EnDeCoding.Encode(this.BDID) + "</BDID>");
                xml.Append("<BUAPBR>" + EnDeCoding.Encode(this.BUAPBR) + "</BUAPBR>");
                xml.Append("<BUID>" + EnDeCoding.Encode(this.BUID) + "</BUID>");
                xml.Append("<CostCenter>" + EnDeCoding.Encode(this.CostCenter) + "</CostCenter>");
                xml.Append("<Location>" + EnDeCoding.Encode(this.Location) + "</Location>");
                xml.Append("<ReportTo>");
                xml.Append(this.ReportTo.XML);
                xml.Append("</ReportTo>");
                return xml.ToString();
            }
        }

        public string XMLFinis
        {
            get
            {
                return "</Identity>";
            }
        }
    }
}
